package com.wframe.project.former.dataservices.integral;

import com.frame.database.JBaseService;
import com.frame.database.JServiceFactory;
import com.frame.database.JdataBean;
import jodd.util.StringUtil;

import java.util.ArrayList;
import java.util.List;

public class IntegralRuleService extends JBaseService<IntegralRuleDao> {
    public static IntegralRuleService getIntance(){

        return JServiceFactory.createJServiceProxy(IntegralRuleService.class);
    }

    public JdataBean queryIntegralRule() throws Exception{
        List<JdataBean> list = new ArrayList<>();
        list = getDao().queryIntegralRule();
        JdataBean ruleBean = new JdataBean();
        for (JdataBean bean :list){
           if("integral_rule".equals(bean.getString("code"))){
                ruleBean.put("dayintegral",bean.getString("val"));
           }
            if("integral_today".equals(bean.getString("code"))){
                ruleBean.put("today",bean.getString("val"));
            }
            if("integral_register".equals(bean.getString("code"))){
                ruleBean.put("register",bean.getString("val"));
            }
            if("integral_scale".equals(bean.getString("code"))){
                ruleBean.put("scale",bean.getString("val"));
            }
        }
        return ruleBean;
    }


}
